package br.com.lopes.gci.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import br.com.lopes.gci.exception.DAOException;;

public interface IDAO<T, ID extends Serializable> {

	public abstract T insert(T object) throws DAOException;

	public void mergeMany(Collection<T> entities) throws DAOException;

	public void createMany(final Collection<T> entities) throws DAOException;

	public void saveOrUpdateMany(final Collection<T> entities)
			throws DAOException;

	public abstract void delete(T object) throws DAOException;

	public void delete(final String namedQuery, final String[] paramNames,
			final Object[] params) throws DAOException;

	public abstract void update(T object) throws DAOException;

	public abstract T merge(T object) throws DAOException;

	public abstract T findByPK(ID pk) throws DAOException;
	
	public List<T> findByCriteria(DetachedCriteria criteria)
			throws DAOException;

	public abstract List<T> findAll() throws DAOException;

	public List<T> getScrollableList(DetachedCriteria criteria,
			int firstResult, int maxResults) throws DAOException;

	public int delete(final String namedQuery, final String paramName,
			final Object param) throws DAOException;

	public List<T> max(final String campo) throws DAOException;
	
	public Integer count() throws DAOException;

	public Integer countByCriteria(final DetachedCriteria criteria)
			throws DAOException;
	
	public void refreshObject(T object) throws DAOException;
	
	public void cleanSession() throws DAOException;
}